<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
		//trim方法 是将字符串的空格删掉
			if(String.prototype.trim===undefined){
				String.prototype.trim=function(){
					return this.replace(/^\s*|\s*$/g,"");
				}
			}
			
			var str="     hello world";
			console.log(str.trim());
		</script>
	</body>
</html>
